package com.canbot.u05.activity.attendance;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.canbot.u05.R;
import com.canbot.u05.activity.BaseActivityNoTitle;
import com.canbot.u05.socket.MsgSendUtils;
import com.canbot.u05.socket.MsgType;
import com.canbot.u05.utils.PathConst;
import com.canbot.u05.utils.ToastTools;

/**
 * 考勤选择界面(1.设置时间 2.信息统计)
 */
public class AttendanceSettingSelectActivity extends BaseActivityNoTitle implements View.OnClickListener {


        private String[] fileName = new String[]{"u05_mjjr_001.wav", "u05_mjjr_002.wav", "u05_mjjr_003.wav", "u05_mjjr_004.wav"};

        private Button btnSetting, btnInfo;

        private ImageView btnBack;


        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_attendance_setting);
                setViews();

                int index = (int) (Math.random() * fileName.length);
                boolean isSuccess = MsgSendUtils.sendStringMsg(MsgType.PLAY_SOUND, PathConst.AUDIO_ATTENDANCE_DIR + fileName[index]);
                if (!isSuccess) {
                        ToastTools.newInstance(this).showText(getString(R.string.network_error));
                }

        }

        /**
         * 用户考勤信息显示界面
         */
        private void setViews() {
                btnSetting = (Button) findViewById(R.id.btn_kq_setting);
                btnInfo = (Button) findViewById(R.id.btn_kq_info);
                btnBack = (ImageView) findViewById(R.id.imageView_back);

                btnBack.setOnClickListener(this);
                btnSetting.setOnClickListener(this);
                btnInfo.setOnClickListener(this);

        }

        @Override
        public void onClick(View view) {
                switch (view.getId()) {
                        case R.id.imageView_back:
                                finish();
                                overridePendingTransition(R.anim.face_zoom_enter, R.anim.face_zoom_exit);
                                break;
                        case R.id.btn_kq_info:
                                startActivity(new Intent(AttendanceSettingSelectActivity.this, AttendanceStatisticsActivity.class));
                                overridePendingTransition(R.anim.face_zoom_enter, R.anim.face_zoom_exit);
                                break;
                        case R.id.btn_kq_setting:
                                startActivity(new Intent(AttendanceSettingSelectActivity.this, AttendanceSettingTimeActivity.class));
                                overridePendingTransition(R.anim.face_zoom_enter, R.anim.face_zoom_exit);
                                break;
                }

        }
}
